package com.supply;

import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;

/**
 * @author : wushikai
 * <p>
 * date : 2021/8/9
 */
public class IdentityHashMapDemo {


    public static void main(String[] args) {
        //IdentityHashMap使用===================================
        Map<String, String> identityHashMap = new IdentityHashMap<>();
        identityHashMap.put(new String("a"), "1");
        identityHashMap.put(new String("a"), "2");
        identityHashMap.put(new String("a"), "3");
        System.out.println(identityHashMap.size()); //3


        Map<String, String> hashMap = new HashMap<>();
        hashMap.put(new String("a"), "1");
        hashMap.put(new String("a"), "2");
        hashMap.put(new String("a"), "3");
        System.out.println(hashMap.size()); //1

    }

}
